package com.example.demo6.utils;

import com.example.demo6.vo.ResultVO;


public class ResultVOUtils {


    public static <T>ResultVO<T> success(Integer code, String msg, T data){
        ResultVO vo = new ResultVO();
        vo.setCode(code);
        vo.setMsg(msg);
        vo.setData(data);
        return vo;
    }
    public static <T>ResultVO<T> fail(Integer code, String msg, T data){
        ResultVO vo = new ResultVO();
        vo.setCode(code);
        vo.setMsg(msg);
        vo.setData(data);
        return vo;
    }

    public static <T>ResultVO<T> fail(){
        ResultVO vo = new ResultVO();
        vo.setCode(500);
        vo.setMsg("fail");
        vo.setData(null);
        return vo;
    }

    public static <T>ResultVO<T> success(T data){
        ResultVO vo = new ResultVO();
        vo.setCode(200);
        vo.setMsg("success");
        vo.setData(data);
        return vo;
    }

}
